/* 
 * File:   Track.h
 * Author: dave
 *
 * Created on 2010年11月2日, 下午5:03
 */

#ifndef TRACK_H
#define	TRACK_H

#include "Data.h"
#include "cv.h"
#include <vector>
#include <stdlib.h>
using namespace std;

class Track {
public:
    Track(Camera *camera);
    Track(const Track& orig);

    vector<trackObject> V;

    //清除缓存
    void Init();
    //CamShift跟踪目标
    void CamShift(vector<trackObject> obj);
    //绘制边框
    void Draw(IplImage * image, CvScalar color);

    virtual ~Track();
private:
    Camera *cam;
    int id;
    CvRect selection;
    CvRect window;
    CvConnectedComp comp;
    CvBox2D box;
    bool Match(CvConnectedComp comp);
    bool Match(CvRect a, CvRect b);
    bool Match(trackObject a);
    void NewObject(vector<trackObject> obj);
    void TrackNew(vector<trackObject> obj);
    void TrackExist();
};

#endif	/* TRACK_H */

